package com.qiantu.phone.ui.adapter;

import android.content.Context;
import android.view.ViewGroup;

import androidx.annotation.NonNull;

import com.hjq.widget.layout.SettingBar;
import com.qiantu.phone.R;
import com.qiantu.phone.app.AppAdapter;

import java.util.Map;

public class PanelQRResultItemAdapter extends AppAdapter<Map> {

    public PanelQRResultItemAdapter(Context context) {
        super(context);
    }

    @NonNull
    @Override
    public PanelQRResultItemAdapter.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
        return new PanelQRResultItemAdapter.ViewHolder();
    }

    private final class ViewHolder extends AppAdapter<?>.ViewHolder {

        private final SettingBar settingBar;

        private ViewHolder() {
            super(R.layout.room_item);
            settingBar = findViewById(R.id.setting_bar);
        }
        @Override
        public void onBindView(int position) {
            Map map = getItem(position);
            settingBar.setLeftText(map.get("name").toString());
            settingBar.setRightText(map.get("info").toString());
        }
    }
}